using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace Hack.Authorization.Fault {

    /// <summary>
    /// The default fault contract for all faults in DigitalFortress.
    /// </summary>
    [DataContract(Namespace = "http://DigitalFortress.com/2007/06", Name = "DefaultFaultContract")]
    public class DefaultFaultContract {

        #region Fields
        int errorId;
        string errorMessage;
        Guid correlationId;
        #endregion Fields

        #region Constructors
        /// <summary>
        /// Default constructor.
        /// </summary>
        public DefaultFaultContract()
            : this(-1, String.Empty, Guid.Empty) {
        }

        /// <summary>
        /// Constructor with values.
        /// </summary>
        /// <param name="errorId">Fault Id.</param>
        /// <param name="errorMessage">Fault message.</param>
        /// <param name="correlationId">Correlated Fault Id.</param>
        public DefaultFaultContract(int errorId, string errorMessage, Guid correlationId) {
            this.errorId = errorId;
            this.errorMessage = errorMessage;
            this.correlationId = correlationId;
        }
        #endregion Constructors

        #region Properties
        /// <summary>
        /// Fault Id.
        /// </summary>
        [DataMember(IsRequired = true, Name = "ErrorId", Order = 1)]
        public int ErrorId {
            get { return errorId; }
            set { errorId = value; }
        }

        /// <summary>
        /// Fault message.
        /// </summary>
        [DataMember(IsRequired = true, Name = "ErrorMessage", Order = 2)]
        public string ErrorMessage {
            get { return errorMessage; }
            set { errorMessage = value; }
        }

        /// <summary>
        /// Correlated fault id.
        /// </summary>
        [DataMember(IsRequired = true, Name = "CorrelationId", Order = 3)]
        public Guid CorrelationId {
            get { return correlationId; }
            set { correlationId = value; }
        }
        #endregion Properties
    }
}
